-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for creating queries via initialized JpqlDsl object #642
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #642 +/- ##
===========================================
+ Coverage 66.79% 67.05% +0.26%
===========================================
Files 479 479
Lines 4824 4863 +39
Branches 277 277
===========================================
+ Hits 3222 3261 +39
Misses 1545 1545
Partials 57 57 ☔ View full report in Codecov by Sentry. |
dd434b7
to
6f0bc37
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the help! I'll change it a bit for the docs.
Oh, I see you're writing English after the Korean review, so I'll leave a review for docs as well. |
{% hint style="info" %} | ||
`jpql()`이 DSL을 인식하기 위해서 `JpqlDsl.Constructor`를 companion object로 구현해야 합니다. | ||
{% endhint %} | ||
나만의 DSL을 `jpql()`에 전달하기 위한 두 가지 방법이 있습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example의 코드가 커서 dot으로는 문맥을 유지하는 것이 쉽지 않아 보입니다. 아래 처럼 먼저 방법을 이야기 하고 header를 이용해 예시를 나누는 것은 어떨까요?
이렇게 만들어진 나만의 DSL을 `jpql()`에 전달하기 위한 두 가지 방법이 있습니다. 첫 번째는 DSL 객체를 생성하는 `JpqlDsl.Constructor`를 companion object로 구현하는 것이고, 두 번째는 DSL 인스턴스를 생성하는 것입니다.
### JpqlDsl.Constructor
// description
// example
### Jpql Instance
// description
// example
|
||
val encryptor = Encryptor() | ||
val instance = MyJpql(encryptor) | ||
val query = jpql(instance) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jpql 객체 생성과 query의 생성 문맥을 분리하기 위해 다음과 같이 개행이 있으면 좋을 것 같아요.
val encryptor = Encryptor()
val instance = MyJpql(encryptor)
val query = jpql(instance) {
// ... query
}
fun myFunction(value: String): Expression<String> { | ||
val encrypted = encryptor.encrypt(value) | ||
return function(String::class, "myFunction", listOf(value(encrypted))) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
예시로는 encryptor라는 특정 기능을 소개하고 있기 때문에 다음과 같이 encryptedValue 라는 메소드로 이름 지으면 어떨까요?
fun encryptedValue(value: String): Expression<String> {
val encrypted = encryptor.encrypt(value)
return value(encrypted)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제안해주신 내용으로 수정해봤는데 조금 더 실용적인 예제면 좋을거 같아서 암호화된 컬럼을 비교하는 코드로 수정해봤습니다!
리뷰 내용이 수정되면 리뷰를 추가 진행하겠습니다. |
6f0bc37
to
0692aba
Compare
0692aba
to
24bf3e8
Compare
@@ -39,6 +42,35 @@ val query = jpql(MyJpql) { | |||
} | |||
``` | |||
|
|||
### Jpql Instance | |||
|
|||
With this method, you can reuse a single instance for query creation and utilize dependency injection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of way
in the introduction and method
in the details doesn't seem to fit together.
How about changing method
to way
?
With this method, you can reuse a single instance for query creation and utilize dependency injection. | |
With this way, you can reuse a single instance for query creation and utilize dependency injection. |
|
||
fun Path<String>.equalToEncrypted(value: String): Predicate { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about removing a newline to make it a little shorter?
24bf3e8
to
be449ce
Compare
Thanks for your help! |
Motivation
Modifications
Commit Convention Rule
commit type
please describe it on the Pull RequestResult
Closes